package com.example;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

/**
 * 创建Activity的要点
 * 1、一个Activity就是一个类，并且这个类继承Activity
 * 2、需要复写onCreate方法
 * 3、每一个Activity都需要在AndroidManifest.xml文件当中进行配置
 * 4、为Activity添加必要的控件
 */
public class Activity01 extends Activity {
    /**
     * Called when the activity is first created.
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Button button01 = (Button)findViewById(R.id.button01);
        button01.setOnClickListener(new Button01Listener());
    }

    class Button01Listener implements View.OnClickListener{
        @Override
        public void onClick(View view) {
            // Generate a new intent object
            Intent intent = new Intent();
            intent.setClass(Activity01.this,Activity02.class);
            intent.putExtra("test", "This is value of extra...");
            Activity01.this.startActivity(intent);
        }
    }
}
